.class public Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter;
.super Lcom/bitauto/autoeasy/tool/ArrayListAdapter;
.source "BrandAdapter.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lcom/bitauto/autoeasy/tool/ArrayListAdapter",
        "<",
        "Lcom/bitauto/autoeasy/selectcar/Object/Brand;",
        ">;"
    }
.end annotation


# direct methods
.method public constructor <init>(Landroid/app/Activity;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 22
    invoke-direct {p0, p1}, Lcom/bitauto/autoeasy/tool/ArrayListAdapter;-><init>(Landroid/app/Activity;)V

    .line 23
    return-void
.end method


# virtual methods
.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 9
    .parameter "position"
    .parameter "convertView"
    .parameter "parent"

    .prologue
    const/4 v8, 0x0

    .line 37
    move-object v5, p2

    .line 40
    .local v5, root:Landroid/view/View;
    const/4 v2, 0x0

    .line 41
    .local v2, flag:Z
    invoke-virtual {p0, p1}, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    .line 43
    .local v0, brand:Lcom/bitauto/autoeasy/selectcar/Object/Brand;
    invoke-virtual {v0}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->getImage()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/String;->length()I

    move-result v7

    if-lez v7, :cond_0

    .line 44
    const/4 v2, 0x1

    .line 46
    :cond_0
    iget-object v7, p0, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter;->mContext:Landroid/app/Activity;

    invoke-virtual {v7}, Landroid/app/Activity;->getLayoutInflater()Landroid/view/LayoutInflater;

    move-result-object v4

    .line 48
    .local v4, inflater:Landroid/view/LayoutInflater;
    if-eqz v2, :cond_2

    .line 49
    const v7, 0x7f030001

    invoke-virtual {v4, v7, v8}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v5

    .line 51
    new-instance v3, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;

    invoke-direct {v3}, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;-><init>()V

    .line 52
    .local v3, holder:Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;
    const/high16 v7, 0x7f0b

    invoke-virtual {v5, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    iput-object v7, v3, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;->textView:Landroid/widget/TextView;

    .line 53
    const v7, 0x7f0b0001

    invoke-virtual {v5, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Lcom/bitauto/autoeasy/widget/RemoteImageView;

    iput-object v7, v3, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;->imageView:Lcom/bitauto/autoeasy/widget/RemoteImageView;

    .line 54
    invoke-virtual {v5, v3}, Landroid/view/View;->setTag(Ljava/lang/Object;)V

    .line 62
    :goto_0
    if-eqz v2, :cond_3

    .line 63
    const/4 v6, 0x0

    .line 65
    .local v6, stream:Ljava/io/InputStream;
    :try_start_0
    iget-object v7, p0, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter;->mContext:Landroid/app/Activity;

    invoke-virtual {v7}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources;

    move-result-object v7

    invoke-virtual {v7}, Landroid/content/res/Resources;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v8

    iget-object v7, p0, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter;->mList:Ljava/util/ArrayList;

    invoke-virtual {v7, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    invoke-virtual {v7}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->getImage()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v8, v7}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v6

    .line 66
    iget-object v8, v3, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;->imageView:Lcom/bitauto/autoeasy/widget/RemoteImageView;

    iget-object v7, p0, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter;->mList:Ljava/util/ArrayList;

    invoke-virtual {v7, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    invoke-virtual {v7}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->getImage()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Landroid/graphics/drawable/Drawable;->createFromStream(Ljava/io/InputStream;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v7

    invoke-virtual {v8, v7}, Lcom/bitauto/autoeasy/widget/RemoteImageView;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 70
    :goto_1
    if-eqz v6, :cond_1

    .line 72
    :try_start_1
    invoke-virtual {v6}, Ljava/io/InputStream;->close()V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_1

    .line 77
    :cond_1
    :goto_2
    iget-object v7, v3, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;->textView:Landroid/widget/TextView;

    iget-object v8, p0, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter;->mList:Ljava/util/ArrayList;

    invoke-virtual {v8, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p0

    .end local p0
    check-cast p0, Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    invoke-virtual {p0}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->getName()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 82
    .end local v6           #stream:Ljava/io/InputStream;
    :goto_3
    return-object v5

    .line 56
    .end local v3           #holder:Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;
    .restart local p0
    :cond_2
    const v7, 0x7f03000f

    invoke-virtual {v4, v7, v8}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v5

    .line 57
    new-instance v3, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;

    invoke-direct {v3}, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;-><init>()V

    .line 58
    .restart local v3       #holder:Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;
    const v7, 0x7f0b0020

    invoke-virtual {v5, v7}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    iput-object v7, v3, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;->textView:Landroid/widget/TextView;

    .line 59
    invoke-virtual {v5, v3}, Landroid/view/View;->setTag(Ljava/lang/Object;)V

    goto :goto_0

    .line 67
    .restart local v6       #stream:Ljava/io/InputStream;
    :catch_0
    move-exception v7

    move-object v1, v7

    .line 68
    .local v1, e:Ljava/io/IOException;
    iget-object v7, v3, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;->imageView:Lcom/bitauto/autoeasy/widget/RemoteImageView;

    const v8, 0x7f020008

    invoke-static {v8}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v8

    invoke-virtual {v7, v8}, Lcom/bitauto/autoeasy/widget/RemoteImageView;->setDefaultImage(Ljava/lang/Integer;)V

    goto :goto_1

    .line 73
    .end local v1           #e:Ljava/io/IOException;
    :catch_1
    move-exception v1

    .line 74
    .restart local v1       #e:Ljava/io/IOException;
    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_2

    .line 79
    .end local v1           #e:Ljava/io/IOException;
    .end local v6           #stream:Ljava/io/InputStream;
    :cond_3
    iget-object v7, v3, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter$ViewHolder;->textView:Landroid/widget/TextView;

    iget-object v8, p0, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter;->mList:Ljava/util/ArrayList;

    invoke-virtual {v8, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p0

    .end local p0
    check-cast p0, Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    invoke-virtual {p0}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->getFirstLetter()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    goto :goto_3
.end method

.method public isEnabled(I)Z
    .locals 2
    .parameter "position"

    .prologue
    .line 27
    iget-object v1, p0, Lcom/bitauto/autoeasy/selectcar/Adapter/BrandAdapter;->mList:Ljava/util/ArrayList;

    invoke-virtual {v1, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object p0

    .end local p0
    check-cast p0, Lcom/bitauto/autoeasy/selectcar/Object/Brand;

    invoke-virtual {p0}, Lcom/bitauto/autoeasy/selectcar/Object/Brand;->getImage()Ljava/lang/String;

    move-result-object v0

    .line 28
    .local v0, url:Ljava/lang/String;
    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v1

    if-lez v1, :cond_0

    .line 29
    const/4 v1, 0x1

    .line 31
    :goto_0
    return v1

    :cond_0
    const/4 v1, 0x0

    goto :goto_0
.end method
